Skip to content

Comments

🚀 [Feature]: Get-GitHubRepository now returns custom properties inline#555

Merged
Marius Storhaug (MariusStorhaug) merged 12 commits intomainfrom
copilot/use-repository-custom-properties
Feb 22, 2026
Merged

🚀 [Feature]: Get-GitHubRepository now returns custom properties inline#555
Marius Storhaug (MariusStorhaug) merged 12 commits intomainfrom
copilot/use-repository-custom-properties

Conversation

Copy link
Contributor

Copilot AI commented Feb 19, 2026

Get-GitHubRepository now includes custom properties directly on the returned object — no separate API call needed. GraphQL queries that encounter unavailable fields now return partial results with warnings instead of failing, and commands that target non-existent resources return nothing instead of throwing errors. Various spelling corrections across source files, documentation, and tests are also included.

New: Custom properties on Get-GitHubRepository results

Get-GitHubRepository now returns custom properties inline when retrieving a repository by name. Previously, retrieving custom properties required a separate call to Get-GitHubRepositoryCustomProperty.

$repo = Get-GitHubRepository -Owner 'PSModule' -Name 'GitHub'
$repo.CustomProperties | Format-Table

# Name   Value
# ----   -----
# Type   Module
# Status Active

A new strongly-typed GitHubCustomProperty class provides Name and Value properties with consistent casing regardless of whether the data comes from the REST or GraphQL API.

Note: Custom properties are populated when using Get-GitHubRepository to fetch a specific repository. Other commands that return repository objects (e.g., listing repositories) may not include custom properties depending on the underlying API response.

Get-GitHubRepositoryCustomProperty remains available if you only need custom properties without the full repository object.

Fixed: Queries no longer fail when some fields are unavailable

GraphQL queries that encounter fields unavailable for some repositories (such as custom properties on repos where permissions are limited) now return the available data and emit warnings for the errors. Previously, any GraphQL error — even with valid data — caused a terminating error.

Fixed: Commands no longer throw when a resource doesn't exist

Commands that query a specific repository, enterprise, or release by name now return nothing instead of throwing an error when the resource doesn't exist. This makes it safe to use these commands in conditional logic without wrapping them in try/catch.

Technical Details

  • New GitHubCustomProperty class in src/classes/public/Repositories/GitHubCustomProperty.ps1 with constructors accepting both REST (property_name) and GraphQL (propertyName) field names.
  • GitHubRepository class: CustomProperties property changed from [PSCustomObject] to [GitHubCustomProperty[]]. PropertyToGraphQLMap entry now maps to repositoryCustomPropertyValues(first: 100) { nodes { propertyName value } }.
  • CustomProperties removed from the GraphQL field exclusion list in Get-GitHubRepositoryByName and Get-GitHubMyRepositoryByName only — these are the private functions behind Get-GitHubRepository.
  • Invoke-GitHubGraphQLQuery: Error handling split into partial-success (data + errors → warnings) and full-failure (errors only → terminating error) branches.
  • Null guards added to Get-GitHubRepositoryByName, Get-GitHubMyRepositoryByName, Get-GitHubEnterpriseByName, Get-GitHubReleaseAssetByTag, and Get-GitHubReleaseAssetFromLatest.
  • Spelling corrections across 18 files in .github/, examples/, src/classes/, src/functions/, and tests/.

Co-authored-by: MariusStorhaug <17722253+MariusStorhaug@users.noreply.github.com>
Copilot AI changed the title [WIP] Update Get-GitHubRepository to use repositoryCustomPropertyValues 🚀 [Feature]: Use repositoryCustomPropertyValues GraphQL field to populate CustomProperties on GitHubRepository Feb 19, 2026
Co-authored-by: MariusStorhaug <17722253+MariusStorhaug@users.noreply.github.com>
@MariusStorhaug Marius Storhaug (MariusStorhaug) marked this pull request as ready for review February 19, 2026 08:07
Copilot AI review requested due to automatic review settings February 19, 2026 08:07
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR enhances the GitHubRepository class to populate CustomProperties directly from GitHub's GraphQL API using the newly available repositoryCustomPropertyValues field, eliminating the need for separate REST API calls to retrieve custom properties.

Changes:

  • Added GraphQL query fragment for repositoryCustomPropertyValues to fetch up to 100 custom properties
  • Implemented transformation logic in both REST and GraphQL constructors to normalize custom property format to PascalCase (Name/Value)
  • Maintained consistency between REST (property_name/value) and GraphQL (propertyName/value) API response formats

Co-authored-by: MariusStorhaug <17722253+MariusStorhaug@users.noreply.github.com>
@MariusStorhaug Marius Storhaug (MariusStorhaug) changed the title 🚀 [Feature]: Use repositoryCustomPropertyValues GraphQL field to populate CustomProperties on GitHubRepository 🚀 [Feature]: Populate CustomProperties on GitHubRepository via GraphQL Feb 21, 2026
@MariusStorhaug Marius Storhaug (MariusStorhaug) changed the title 🚀 [Feature]: Populate CustomProperties on GitHubRepository via GraphQL 🚀 [Feature]: Use repositoryCustomPropertyValues to populate CustomProperties on GitHubRepository Feb 21, 2026
@MariusStorhaug Marius Storhaug (MariusStorhaug) changed the title 🚀 [Feature]: Use repositoryCustomPropertyValues to populate CustomProperties on GitHubRepository 🚀 [Feature]: Repository custom properties now included directly on repository objects Feb 21, 2026
@MariusStorhaug Marius Storhaug (MariusStorhaug) changed the title 🚀 [Feature]: Repository custom properties now included directly on repository objects 🚀 [Feature]: Get-GitHubRepository now returns custom properties inline Feb 22, 2026
@MariusStorhaug Marius Storhaug (MariusStorhaug) merged commit a489f06 into main Feb 22, 2026
345 of 352 checks passed
@MariusStorhaug Marius Storhaug (MariusStorhaug) deleted the copilot/use-repository-custom-properties branch February 22, 2026 10:35
@github-actions
Copy link
Contributor

✅ New release: PowerShell Gallery - GitHub 0.41.0

@github-actions
Copy link
Contributor

✅ New release: GitHub - GitHub v0.41.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment